---
output:
  html_document:
    preserve_line_breaks: true
  pdf_document:
    latex_engine: xelatex
---

# Replication of ``Disclosing Invisible Attributes Leads to Discrimination,'' *Journal of Race, Ethnicity, and Politics*

## Kai Zhou and Yusaku Horiuchi

------------------------------------------------------------------------

## Description

- This replication package reproduces all figures reported in the paper and its supplementary materials.

- All scripts write console output and messages to per-script log files saved in `logs/`.

------------------------------------------------------------------------

## Folder Tree

```text
replication_package/
|-- zhou-horiuchi.Rproj
|-- master.R
|-- README.md
|-- README.pdf
|-- README.html
|-- session_info.log
|
|-- data/
|   |-- irt_pretest_survey.csv
|   |-- study1_survey.csv
|   |-- study2_survey.csv
|
|-- documents/
|   |-- paper/
|   |   |-- accepted_version.pdf
|   |
|   |-- questionnaires/
|       |-- study1_questionnaire.docx
|       |-- study2_questionnaire.docx
|       |-- irt_pretest_survey_questionnaire.docx
|
|-- figures/
|   |-- combined/
|   |   |-- pre-registered_hypotheses.pdf
|   |   |-- mm_amce-by-experiment.pdf
|   |
|   |-- study1/
|   |   |-- pre-registered_hypotheses.pdf
|   |   |-- profile_level_MMs.pdf
|   |   |-- estimates_by_resentment.pdf
|   |   |-- estimates_by_respondent_gender.pdf
|   |   |-- estimates_by_respondent_age.pdf
|   |   |-- estimates_by_respondent_education.pdf
|   |   |-- estimates_by_political_leaning.pdf
|   |   |-- estimates_by_three_regions.pdf
|   |   |-- estimates_by_nationalism.pdf
|   |   |-- estimates_by_applicant_gender.pdf
|   |
|   |-- study2/
|   |   |-- pre-registered_hypotheses.pdf
|   |   |-- profile_level_MMs.pdf
|   |   |-- irt_traceplot.pdf
|   |   |-- contact_agg_MMs.pdf
|   |   |-- contact_irt_MMs.pdf
|   |   |-- contact_irtResidual_MMs.pdf
|   |   |-- agg_irt_corr.pdf
|   |
|   |-- irt_pretest/
|       |-- ICC.pdf
|
|-- functions/
|   |-- expand_profile_data.R
|   |-- logging.R
|   |-- make_figure.R
|   |-- read_Qualtrics.R
|   |-- reshape_conjoint.R
|   |-- scaling_pretest.R
|   |-- test_hypotheses.R
|   |-- tracePlot.R
|   |-- visualize_MMs.R
|   |-- wrangle_data.R
|
|-- logs/
|   |-- combined.log
|   |-- study1.log
|   |-- study2.log
|   |-- irt_pretest.log
|
|-- output/
|   |-- study1/
|   |   |-- data_for_analysis.rds
|   |-- study2/
|   |   |-- data_for_analysis.rds
|   |-- irt_pretest/
|   |   |-- data_for_analysis.rds
|
|-- scripts/
|   |-- study1.R
|   |-- study2.R
|   |-- study1_study2_combined.R
|   |-- irt_pretest.R
```

------------------------------------------------------------------------

## Files Included in This Package

- **`master.R`**  
  Master script that runs the three scripts in `scripts/` sequentially, writing log files to `logs/`.

- **`README.md` / `README.html` / `README.pdf`**  
  Documentation describing the replication package, directory structure, and figure–script mapping.

- **`zhou-horiuchi.Rproj`**  
  RStudio project file (optional but recommended).

- **`data/`**  
  Raw survey data used in the analyses:
  - `study1_survey.csv`
  - `study2_survey.csv`
  - `irt_pretest_survey.csv`

- **`documents/`**  
  Supporting documentation:
  - `paper/accepted_version.pdf` is the accepted manuscript.
  - `questionnaires/` contains survey instruments for Studies 1 and 2.

- **`functions/`**  
  Reusable R functions sourced by the scripts.

- **`scripts/`**  
  Analysis scripts that:
  1. Process raw survey data into analysis-ready objects saved in `output/`
  2. Generate all figures saved in `figures/`

- **`output/`**  
  Intermediate analysis objects (e.g., `.rds`) created by scripts.

- **`figures/`**  
  All generated figures (PDF), organized by study and combined analyses.

- **`logs/`**  
  Per-script log files created during execution.

------------------------------------------------------------------------

## How to Run

1. Open the project directory (recommended: open `zhou-horiuchi.Rproj` in RStudio).
2. From the project root, run:

```r
source("master.R")
```

Alternatively, you can run a specific part of the workflow:

```r
source("scripts/study1.R")
source("scripts/study2.R")
source("scripts/study1_study2_combined.R")
source("scripts/irt_pretest.R")
```

------------------------------------------------------------------------

## Session information

- The file `session_info.log` records the R version, platform, and loaded packages from a successful run of the replication package.

------------------------------------------------------------------------

## Replication Guide: Figures

### Manuscript Figures

- **Figure 1**  
  Conceptual figure in the manuscript (no code).

- **Figure 2**  
  Output: `figures/study1/pre-registered_hypotheses.pdf`  

- **Figure 3**  
  Output: `figures/study2/contact_agg_MMs.pdf`  

- **Figure 4**  
  Output: `figures/study1/estimates_by_resentment.pdf`  

### Appendix / Supplementary Figures

- **Figure B.1**  
  Output: `figures/irt_pretest/ICC.pdf`    

- **Figure B.2**  
  Output: `figures/study2/agg_irt_corr.pdf`  

- **Figure B.3**  
  Output: `figures/study2/contact_irt_MMs.pdf`  

- **Figure C.1**  
  Output: `figures/study1/profile_level_MMs.pdf`  

- **Figure C.2**  
  Output: `figures/study2/profile_level_MMs.pdf`  

- **Figure C.3**  
  Output: `figures/study2/pre-registered_hypotheses.pdf`  

- **Figure C.4**  
  Output: `combined/pre-registered_hypotheses.pdf`  

- **Figure C.5**  
  Output: `figures/combined/mm_amce-by-experiment.pdf`  

- **Figure C.6**  
  Output: `figures/study2/contact_irtResidual_MMs.pdf`  

- **Figure C.7**  
  Output: `figures/study1/estimates_by_respondent_gender.pdf`  

- **Figure C.8**  
  Output: `figures/study1/estimates_by_respondent_age.pdf`  

- **Figure C.9**  
  Output: `figures/study1/estimates_by_respondent_education.pdf`  

- **Figure C.10**  
  Output: `figures/study1/estimates_by_political_leaning.pdf`  

- **Figure C.11**  
  Output: `figures/study1/estimates_by_respondent_age.pdf`  

- **Figure C.12**  
  Output: `figures/study1/estimates_by_nationalism.pdf`  

- **Figure C.13**  
  Output: `figures/study1/estimates_by_applicant_gender.pdf`  
  
------------------------------------------------------------------------

## Recommended citation

If you use or adapt the analysis code, please cite the replication data archive associated with the published article.

------------------------------------------------------------------------

## Last verified

- **February 2026**
